package particle;

import javafx.scene.CacheHint;
import javafx.scene.effect.Blend;
import javafx.scene.effect.BlendMode;
import javafx.scene.effect.ColorAdjust;
import javafx.scene.effect.ColorInput;
import javafx.scene.image.ImageView;
import javafx.scene.paint.Color;

public class ColorChanger {

	private Blend blend;
	private ColorAdjust adjuster;

	public ColorChanger(Color color, ImageView image) {
		
		image.setClip(new ImageView(image.getImage()));
		
		adjuster = new ColorAdjust();
		adjuster.setSaturation(-1.0);

		blend = new Blend(BlendMode.MULTIPLY, adjuster, new ColorInput(0,
				0, image.getImage().getWidth(), image.getImage().getHeight(),
				color));
		image.setEffect(blend);
		image.setCache(true);
        image.setCacheHint(CacheHint.SPEED);
	}

}
